home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
rjs.lha
/
RJS
/
String
/
src
/
op_minusequal.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-14
|
801b
|
49 lines
#include "String.h"
RJS_String &RJS_String::operator-=(int i)
{
right(i)="";
return *this;
}
RJS_String &RJS_String::operator-=(char ch)
{
if (right(1)==ch) right(1)="";
return *this;
}
RJS_String &RJS_String::operator-=(const char *s)
{
int len=RJS_String::length(s);
if (right(len)==s) right(len)="";
return *this;
}
RJS_String &RJS_String::operator-=(const RJS_String &s)
{
if (right(s.length())==s) right(s.length())="";
return *this;
}
RJS_String &RJS_String::operator-=(const RJS_StringSearch &ss)
{
int ss_pos,ss_len;
int pos=length()-1;
substr(pos).match(ss,ss_pos,ss_len);
while (pos>=0 && ss_pos==0 && ss_len) {
pos--;
substr(pos).match(ss,ss_pos,ss_len);
}
int matched_len=length()-1-pos;
if (matched_len) right(matched_len)="";
return *this;
}